package com.xy.biz.xd.controller;

import com.xy.biz.fd.domain.req.documentCode.GetDocumentByCodeRequest;
import com.xy.biz.fd.domain.resp.GetSourceFlowUserAndGroupResponse;
import com.xy.biz.xd.domain.req.*;
import com.xy.biz.xd.service.DocumentFlowBorrowAndPrintAndDropService;
import com.xy.biz.xd.service.DocumentFlowNewAndModifyService;
import com.xy.lang.domain.Result;
import com.xy.lang.validation.UpdateChecks;
import com.xy.lang.validation.annotation.Validatable;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

public abstract class AbstractDocumentFlowBorrowAndPrintAndDropController {

    protected DocumentFlowBorrowAndPrintAndDropService documentFlowBorrowAndPrintAndDropService;

    protected abstract void setDocumentFlowBorrowAndPrintAndDropService(DocumentFlowBorrowAndPrintAndDropService documentFlowBorrowAndPrintAndDropService);


    @ApiOperation("审核")
    @Validatable(groups = {UpdateChecks.class})
    @PostMapping(value = "/content_audit")
    public Result<?> contentAuditDocumentFlow(@RequestBody HandleDocumentFlowRequest request) {
        return documentFlowBorrowAndPrintAndDropService.contentAuditDocumentFlow(request);
    }


//    @ApiOperation("评审")
//    @Validatable(groups = {UpdateChecks.class})
//    @PostMapping(value = "/review")
//    public Result<?> reviewDocumentFlow(@RequestBody ReviewDocumentFlowRequest request) {
//        return documentFlowBorrowAndPrintAndDropService.reviewDocumentFlow(request);
//    }

    @ApiOperation("审批")
    @Validatable(groups = {UpdateChecks.class})
    @PostMapping(value = "/approval")
    public Result<?> approvalDocumentFlow(@RequestBody HandleDocumentFlowRequest request) {
        return documentFlowBorrowAndPrintAndDropService.approvalDocumentFlow(request);
    }

//    @ApiOperation("放行")
//    @Validatable(groups = {UpdateChecks.class})
//    @PostMapping(value = "/release")
//    public Result<?> releaseDocumentFlow(@RequestBody ReleaseDocumentFlowRequest request) {
//        return documentFlowBorrowAndPrintAndDropService.releaseDocumentFlow(request);
//    }

    @ApiOperation("获取当前下载or作废流程信息")
    @PostMapping(value = "/getDocumentFlowPrintAndDrop")
    public Result<?> getDocumentFlowPrintAndDrop(@RequestBody GetDocumentFlowRequest request) {
        return documentFlowBorrowAndPrintAndDropService.getDocumentFlowPrintAndDrop(request.getDocumentFlowId());
    }

    @ApiOperation("获取原新建流程发放的人员和部门")
    @PostMapping(value = "/get_source_flow_user_and_group")
    public Result<GetSourceFlowUserAndGroupResponse> getSourceFlowUserAndGroup(@RequestBody GetDocumentByCodeRequest request) {
        return documentFlowBorrowAndPrintAndDropService.getSourceFlowUserAndGroup(request);
    }

}
